ninab222 2.2.2
Loading...
Searching...
No Matches
ninab222


NINA-B222 Click

NINA-B222 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Nenad Filipovic
  • Date : Jan 2024.
  • Type : UART type

Software Support

Example Description

This example desmonstrates the use of NINA-B222 Click board by processing the incoming data and displaying them on the USB UART.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.NINAB222

Example Key Functions

Application Init

Initializes the driver and performs the Click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
ninab222_cfg_t ninab222_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ninab222_cfg_setup( &ninab222_cfg );
if ( UART_ERROR == ninab222_init( &ninab222, &ninab222_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
ninab222_hw_reset( &ninab222 );
Delay_ms ( 1000 );
log_info( &logger, " Configuring the module " );
Delay_ms ( 1000 );
Delay_ms ( 100 );
do
{
Delay_ms ( 100 );
}
while ( NINAB222_OK != ninab222_process( &ninab222 ) );
Delay_ms ( 500 );
do
{
ninab222_get_info( &ninab222 );
Delay_ms ( 100 );
}
while ( NINAB222_OK != ninab222_process( &ninab222 ) );
Delay_ms ( 500 );
do
{
Delay_ms ( 100 );
}
while ( NINAB222_OK != ninab222_process( &ninab222 ) );
Delay_ms ( 500 );
do
{
Delay_ms ( 100 );
}
while ( NINAB222_OK != ninab222_process( &ninab222 ) );
Delay_ms ( 500 );
do
{
Delay_ms ( 100 );
}
while ( NINAB222_OK != ninab222_process( &ninab222 ) );
Delay_ms ( 500 );
do
{
Delay_ms ( 100 );
}
while ( NINAB222_OK != ninab222_process( &ninab222 ) );
ninab222_clear_app_buf( );
Delay_ms ( 500 );
log_info( &logger, " Configuration is complete " );
log_info( &logger, " Application Task " );
Delay_ms ( 100 );
}
#define NINAB222_MODE_DATA
Definition ninab222.h:208
#define NINAB222_ECHO_ON
Definition ninab222.h:201
#define NINAB222_PIN_STATE_LOW
NINA-B222 pin logic states data values.
Definition ninab222.h:253
#define NINAB222_PIN_STATE_HIGH
Definition ninab222.h:254
#define NINAB222_GAP_MODE_GEN_DISC
Definition ninab222.h:241
#define NINAB222_GAP_MODE_CONN
Definition ninab222.h:233
#define NINAB222_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition ninab222.h:280
err_t ninab222_set_discoverability(ninab222_t *ctx, uint8_t d_mode)
NINA-B222 sets discoverability mode function.
void ninab222_set_sry_pin(ninab222_t *ctx, uint8_t state)
NINA-B222 set SRY pin state function.
void ninab222_hw_reset(ninab222_t *ctx)
NINA-B222 HW reset function.
err_t ninab222_set_echo(ninab222_t *ctx, uint8_t echo_en)
NINA-B222 set echo function.
err_t ninab222_get_info(ninab222_t *ctx)
NINA-B222 get module-info function.
void application_init(void)
Definition main.c:78
#define DEVICE_NAME
Definition main.c:40
#define MIKROBUS_POSITION_NINAB222
Definition main.c:36
@ NINAB222_OK
Definition ninab222.h:348

Application Task

Reads and processes all incoming data and displays them on the USB UART.

void application_task ( void )
{
if ( NINAB222_OK == ninab222_process( &ninab222 ) )
{
ninab222_log_app_buf( );
ninab222_clear_app_buf( );
}
}
void application_task(void)
Definition main.c:169

Note

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.